Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow 0s for maxCacheSize and maxCacheByteSize #9156

Merged
merged 2 commits into from
Sep 16, 2024
Merged

Conversation

sraimund
Copy link

Closes #9155

Background

It is sometimes desirable to disable the cache of TileLayer.

Change List

  • 0 values are now possible for maxCacheSize and maxCacheByteSize by using nullish coalescing and non-strict comparison with null.

Copy link
Collaborator

@ibgreen ibgreen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sraimund This looks good to me. Just some thoughts:

  • Would changing the default value for the prop be cleaner or that doesn't work?
  • Is there an easy way to add a minimal test case?
  • Worth mentioning something in the docs or this is just a silent bug fix?

@coveralls
Copy link

coveralls commented Sep 13, 2024

Coverage Status

coverage: 91.79%. remained the same
when pulling fb94e0c on sraimund:master
into c20af82 on visgl:master.

By allowing 0s for maxCacheSize and maxCacheByteSize, the cache of TileLayer can be disabled.
@sraimund
Copy link
Author

@ibgreen Sorry, I missed two occurrences of maxCacheByteSize, that's why I amended the commit. Concerning your questions:

  • I think the default values are fine (i.e., the cache is enabled by default).
  • tileset-2d.spec.ts already contains two test cases for using small values of maxCacheSize and maxCacheByteSize, thus I think it's not needed to add another one. Supporting 0s is just a bit more intuitive than using 1s, which lead to the same behaviour (i.e., non-visible tiles are removed immediately from the cache).
  • I added a sentence to the docs in case maxCacheByteSize is not supplied (anolog to maxCacheSize).

@ibgreen ibgreen merged commit 68533ae into visgl:master Sep 16, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] Disabling the cache for TileLayers
4 participants